//
// Created by admin on 2022/6/11.
// 155. 最小栈: https://leetcode.cn/problems/min-stack/
//
#include <stack>
#include <climits>

using namespace std;

class MinStack {
public:
    stack<int> dataStk;
    stack<int> minStk;
    MinStack() {
        minStk.push(INT_MAX);
    }

    void push(int val) {
        dataStk.push(val);
        minStk.push(min(minStk.top(),val));
    }

    void pop() {
        dataStk.pop();
        minStk.pop();
    }

    int top() {
        return dataStk.top();
    }

    int getMin() {
        return minStk.top();
    }
};
